/*
 * @Author: your name
 * @Date: 2021-08-19 19:49:02
 * @LastEditTime: 2021-09-23 09:51:35
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \xbsg-wx\utlis\https.js
 */
// 封装get请求
const baseUrl = "http://139.196.221.112:8600"
export const myRequest = (options)=>{
	return new Promise((resolve,reject)=>{
		uni.request({
			method: options.method||"GET",
			header:{
			    "content-type": "application/json",
			    "Authorization": "6KW/6YOo6aOf6LC356S+5Yy66L+Q6JCl566h55CG5bmz5Y+w"
			},
			data: options.data,
			url: baseUrl+options.url,
			success(res) {
				if(res.data.code != 200) {
					uni.showToast({
						title: '获取数据失败'
					})
					reject(res.data.msg)
				}else{
					console.log(`${options.url}请求成功`);
					resolve(res.data)
				}
				
			},
			fail(err) {
				uni.showToast({
					title: '获取数据失败'
				})
				reject(err)
			}
		})
	})
}